


#ifndef ME218_ISR_HEADER_FILE		// make sure header file is included only once
#define ME218_ISR_HEADER_FILE

#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/io.h>



// ======================= Oscilloscope bits =================



// These are the bits that I am borrowing
// from the six buttons to trigger the scope
// PB5
#define		SCOPE_ISR_LOW	PORTC &= 0xdf;			// 1101 1111
#define		SCOPE_ISR_HIGH	PORTC |= 0x20;			// 0010	0000

//#define		SCOPE_ISR_LOW		
//#define		SCOPE_ISR_HIGH

#define		SCOPE_CLUT_LOW	PORTC &= 0xef;			// 1110 1111
#define		SCOPE_CLUT_HIGH	PORTC |= 0x10;			// 0001 0000

//#define		SCOPE_CLUT_LOW		
//#define		SCOPE_CLUT_HIGH		


#define		SCOPE_MIDI_LOW	PORTC &= 0xf7;			// 1111 0111
#define		SCOPE_MIDI_HIGH	PORTC |= 0x08;			// 0000 1000

#define		SCOPE_BRIGHTNESS_LOW	PORTC &= 0xfb;	// 1111 1011
#define		SCOPE_BRIGHTNESS_HIGH	PORTC |= 0x04;	// 0000 0100

#define		SCOPE_GRAPHIC_SPRITES_LOW	PORTC &= 0xfd;		// 1111 1101
#define		SCOPE_GRAPHIC_SPRITES_HIGH	PORTC |= 0x02;		// 0000 0010

#define		SCOPE_BLINKY_LOW	PORTC &= 0xfe;		// 1111 1110
#define		SCOPE_BLINKY_HIGH	PORTC |= 0x01;		// 0000 0001


//	static unsigned long	CollisionMask[32];


// ======================== Defines ======================================

#define MAX_BRIGHTNESS 15			// 16 steps of brightness per pixel


// ======================= Variables ========================================



static unsigned						blinky_red_led;
static unsigned						blinky_red_toggle;
static unsigned						blinky_speed;


static unsigned						bright_red_array[8];
static unsigned						bright_green_array[8];
static unsigned						bright_blue_array[8];

static int							brightness_grid_index;
static unsigned char				brightness_grid[8*(MAX_BRIGHTNESS+1)*3];
 
static	int							bright_cmp_mask;
static	int							bright_index;

static unsigned char				currentCol;
static unsigned char				currentBrightness;

static unsigned int					daisy_y;
static unsigned int					daisy_x;
static unsigned int					daisy_color;
static unsigned int					daisy_state;

static unsigned char				GameSlate[8][8];

volatile static unsigned int		MIDI_word;
register unsigned char				MIDI_shift asm("r3");
//static unsigned int		MIDI_word;
//static unsigned int		MIDI_shift;

static unsigned int					Poor_Man;



// =========================== Save SREG  =====================================

/*
 
 //	Vector 14
 // define SREG 0x3f
 
 ISR(TIMER0_COMPA_vect,ISR_NAKED) {
 asm ("push r0");
 asm ("in r0 , 0x3f");
 asm ("push r0");
 
 // code here
 
 asm ("pop r0");
 asm ("out 0x3f , r0");
 asm ("pop r0");
 }
 
 // ================ 11. Interrupts page 56 ====================
 
 ISR(TWI_vect) {
 
 }
 
 
 //	Vector 15
 ISR(TIMER0_COMPA_vect) {	
 }
 
 //	Vector 16
 ISR(TIMER0_COMPB_vect) {	
 }
 
 // Vector 17
 ISR(TIMER0_OVF_vect) {
 }
 
 */

#endif // header file













